home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 February: Technology Seed / Mac Tech Seed Feb '97.toast / OpenDoc 1.2b2c1 / TestParts / Clock / Clock.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-01  |  41.3 KB  |  1,699 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        Clock.cpp
  3.  
  4.     Contains:    Source code for the sample "Clock" part
  5.  
  6.     Owned by:    Richard Rodseth
  7.  
  8.     Copyright:    © 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <3>      12/13/96    JP        1607652: Disabled debugging code
  13.          <2>     5/24/96    jpa        1246074: SOM_CATCH --> SOM_TRY
  14.     To Do:
  15.     
  16.     In Progress:
  17.         
  18. */
  19.  
  20. #define SOM_Module_clock_Source
  21. #define VARIABLE_MACROS
  22. #ifndef _ALTPOINT_
  23. #include "AltPoint.h"            // Use C++ savvy ODPoint and ODRect
  24. #endif
  25.  
  26. #include <Clock.xih>
  27.  
  28. #ifndef _ODTYPES_
  29. #include <ODTypes.h>
  30. #endif
  31.  
  32. #ifndef _CLOCKDEF_
  33. #include "ClockDef.h"
  34. #endif
  35.  
  36. #ifndef _PLFMDEF_
  37. #include "PlfmDef.h"
  38. #endif
  39.  
  40.  
  41. #ifndef _SIHELPER_
  42. #include "SIHelper.h"
  43. #endif
  44.  
  45. #ifndef SOM_Module_OpenDoc_Foci_defined
  46. #include <Foci.xh>
  47. #endif
  48.  
  49. #ifndef _USERSRCM_
  50. #include "UseRsrcM.h"
  51. #endif
  52.  
  53. #ifndef SOM_ODFocusSet_xh
  54. #include <FocusSet.xh>
  55. #endif
  56.  
  57. #ifndef SOM_Module_OpenDoc_StdProps_defined
  58. #include <StdProps.xh>
  59. #endif
  60.  
  61. #ifndef SOM_Module_OpenDoc_StdTypes_defined
  62. #include <StdTypes.xh>
  63. #endif
  64.  
  65. #ifndef SOM_Module_OpenDoc_StdDefs_defined
  66. #include <StdDefs.xh>
  67. #endif
  68.  
  69. #ifndef SOM_ODDraft_xh
  70. #include <Draft.xh>
  71. #endif
  72.  
  73. #ifndef SOM_ODDocument_xh
  74. #include <Document.xh>
  75. #endif
  76.  
  77. #ifndef SOM_ODContainer_xh
  78. #include <ODCtr.xh>
  79. #endif
  80.  
  81. #ifndef SOM_ODStorageUnit_xh
  82. #include <StorageU.xh>
  83. #endif
  84.  
  85. #ifndef SOM_ODStorageUnitView_xh
  86. #include <SUView.xh>
  87. #endif
  88.  
  89. #ifndef SOM_ODStorageUnitCursor_xh
  90. #include <SUCursor.xh>
  91. #endif
  92.  
  93. #ifndef SOM_ODSession_xh
  94. #include <ODSessn.xh>
  95. #endif
  96.  
  97. #ifndef SOM_ODWindowState_xh
  98. #include <WinStat.xh>
  99. #endif
  100.  
  101. #ifndef SOM_ODFrame_xh
  102. #include <Frame.xh>
  103. #endif
  104.  
  105. #ifndef SOM_ODFacet_xh
  106. #include <Facet.xh>
  107. #endif
  108.  
  109. #ifndef SOM_ODFrameFacetIterator_xh
  110. #include <FrFaItr.xh>
  111. #endif
  112.  
  113. #ifndef SOM_ODExtension_xh
  114. #include <Extensn.xh>
  115. #endif
  116.  
  117. #ifndef _ORDCOLL_
  118. #include "OrdColl.h"
  119. #endif
  120.  
  121. #ifndef SOM_ODDispatcher_xh
  122. #include <Disptch.xh>
  123. #endif
  124.  
  125. #ifndef _ODUTILS_
  126. #include <ODUtils.h>
  127. #endif
  128.  
  129. #ifndef SOM_ODMenuBar_xh
  130. #include <MenuBar.xh>
  131. #endif
  132.  
  133. #ifndef SOM_Module_OpenDoc_Commands_defined
  134. #include <CmdDefs.xh>
  135. #endif
  136.  
  137. #ifndef _ITEXT_
  138. #include <IText.h>
  139. #endif
  140.  
  141. #ifndef _ISOSTRING_
  142. #include "ISOStr.h"
  143. #endif
  144.  
  145. #ifndef SOM_ODMessageInterface_xh
  146. #include <MssgIntf.xh>
  147. #endif
  148.  
  149. #ifndef _AEOBJECTS_
  150. #include "AEObjects.h"
  151. #endif
  152.  
  153. #ifndef _FOCUSLIB_
  154. #include "FocusLib.h"
  155. #endif
  156.  
  157. #ifndef SOM_ODArbitrator_xh
  158. #include <Arbitrat.xh>
  159. #endif
  160.  
  161. #ifndef SOM_ODWindow_xh
  162. #include <Window.xh>
  163. #endif
  164.  
  165. #ifndef SOM_ODShape_xh
  166. #include <Shape.xh>
  167. #endif
  168.  
  169. #ifndef SOM_ODTransform_xh
  170. #include <Trnsform.xh>
  171. #endif
  172.  
  173. #ifndef _EXCEPT_
  174. #include "Except.h"
  175. #endif
  176.  
  177. #ifndef __MENUS__
  178. #include <Menus.h>
  179. #endif
  180.  
  181. #ifndef __OSUTILS__
  182. #include <OSUtils.h>
  183. #endif
  184.  
  185. #ifndef __TOOLUTILS__
  186. #include <ToolUtils.h>
  187. #endif
  188.  
  189. #ifndef __FONTS__
  190. #include <Fonts.h>
  191. #endif
  192.  
  193. #ifndef __SCRIPT__
  194. #include <Script.h>
  195. #endif
  196.  
  197. #ifndef __TYPES__
  198. #include <Types.h>
  199. #endif
  200.  
  201. #ifndef __PACKAGES__
  202. #include <Packages.h>
  203. #endif
  204.  
  205. #ifndef __RESOURCES__
  206. #include <Resources.h>
  207. #endif
  208.  
  209. #ifndef __DIALOGS__
  210. #include "Dialogs.h"
  211. #endif
  212.  
  213. #ifndef __TEXTEDIT__
  214. #include <TextEdit.h>
  215. #endif
  216.  
  217. #ifndef __PACKAGES__
  218. #include <Packages.h>
  219. #endif
  220.  
  221. #ifndef __STRINGS__
  222. #include <Strings.h>
  223. #endif
  224.  
  225. #ifndef __FP__
  226. #include <Fp.h>
  227. #endif
  228.  
  229. #include <string.h>
  230.  
  231. #ifndef _ODDEBUG_
  232. #include "ODDebug.h"    
  233. #endif
  234.  
  235. #ifndef _STDTYPIO_
  236. #include "StdTypIO.h"
  237. #endif
  238.  
  239. #ifndef _INFOUTIL_
  240. #include <InfoUtil.h>
  241. #endif
  242.  
  243. #ifndef _WINUTILS_
  244. #include "WinUtils.h"
  245. #endif
  246.  
  247. #ifndef _ITEXT_
  248. #include <IText.h>
  249. #endif
  250.  
  251. #ifndef _PASCLSTR_
  252. #include "PasclStr.h"
  253. #endif
  254.  
  255. #ifndef _STORUTIL_
  256. #include <StorUtil.h>
  257. #endif
  258.  
  259. #ifndef SOM_Module_OpenDoc_StandardExtensions_defined
  260. #include <StdExts.xh>
  261. #endif
  262.  
  263. #ifndef _CLOCKFRM_
  264. #include "ClockFrm.h"
  265. #endif
  266.  
  267. #ifndef _CLOCKGBL_
  268. #include "ClockGbl.h"
  269. #endif
  270.  
  271. #ifndef _CLOCKPRT_
  272. #include "ClockPrt.h"
  273. #endif
  274.  
  275. #ifndef SOM_ClockSI_xh
  276. #include <ClockSI.xh>
  277. #endif
  278.  
  279. #pragma segment Clock
  280.  
  281. #define ODDebugLayers 0        // Set to 1 for printfs of suspend/resume and activate events
  282.  
  283.  
  284. //=========================================================================
  285. // SOM methods for Clock
  286. //=========================================================================
  287.  
  288. //-------------------------------------------------------------------------
  289. // Constructor/Destructor
  290. //-------------------------------------------------------------------------
  291.     
  292. SOM_Scope void  SOMLINK AppleTest_ClocksomInit(AppleTest_Clock *somSelf) 
  293. {
  294.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  295.     AppleTest_ClockMethodDebug("Clock","somInit");
  296.  
  297.     AppleTest_Clock_parents_somInit(somSelf);
  298.         
  299.     _fClockPart = kODNULL;
  300. }
  301.  
  302. SOM_Scope void  SOMLINK AppleTest_ClockInitPart(AppleTest_Clock *somSelf, Environment *ev,
  303.         ODStorageUnit* storageUnit, ODPart* partWrapper)
  304. {
  305.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  306.     AppleTest_ClockMethodDebug("Clock","InitPart");
  307.  
  308.     SOM_TRY
  309.         
  310.     parent_InitPart(somSelf, ev, storageUnit, partWrapper);
  311.     
  312.     ODSession* session = somSelf->GetStorageUnit(ev)->GetSession(ev); 
  313.         //$$$$$ Shouldn't OpenDoc pass the session to InitPart?
  314.     
  315.     _fClockPart = new ClockPart;
  316.     _fClockPart->InitClockPart(ev, session, somSelf, partWrapper);
  317.     
  318.     _fClockPart->PrepareStorage(ev, storageUnit); 
  319.  
  320.     SOM_CATCH_ALL_ENDTRY
  321. }
  322.     
  323. SOM_Scope void  SOMLINK AppleTest_ClockInitPartFromStorage(AppleTest_Clock *somSelf, Environment *ev,
  324.         ODStorageUnit* storageUnit, ODPart* partWrapper)
  325. {
  326.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  327.     AppleTest_ClockMethodDebug("Clock","InitPartFromStorage");
  328.  
  329.     SOM_TRY
  330.     
  331.     parent_InitPartFromStorage(somSelf, ev, storageUnit, partWrapper);
  332.     
  333.     ODSession* session = somSelf->GetStorageUnit(ev)->GetSession(ev); 
  334.         //$$$$$ Shouldn't OpenDoc pass the session to InitPartFromStorage?
  335.  
  336.     _fClockPart = new ClockPart;
  337.     _fClockPart->InitClockPart(ev, session, somSelf, partWrapper);
  338.     _fClockPart->Internalize(ev, storageUnit);
  339.  
  340.     SOM_CATCH_ALL_ENDTRY
  341. }
  342.  
  343.     
  344. SOM_Scope void  SOMLINK AppleTest_ClocksomUninit(AppleTest_Clock *somSelf)
  345. {
  346.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  347.     AppleTest_ClockMethodDebug("Clock","somUninit");
  348.  
  349.     delete _fClockPart;
  350.     
  351.     AppleTest_Clock_parents_somUninit(somSelf);
  352.  
  353. }
  354.     
  355.  
  356.  
  357. //-------------------------------------------------------------------------
  358. // Implementation for DragAndDrop protocol:
  359. //
  360. //        The Drag and Drop protocol provides facilities for interaction with
  361. //        the user during the dragging of OpenDoc objects. Only part handlers 
  362. //        that support embedding of content need to implement the following
  363. //        methods.
  364. //
  365. //        The Clock Part implements the ::DragEnter, ::DragLeave, and ::Drop
  366. //        methods only to provide the user a bit of feedback while dragging
  367. //        objects.
  368. //
  369. //-------------------------------------------------------------------------
  370.  
  371. //------------------------------------------------------------------------------
  372. // Clock: FulfillPromise
  373. //------------------------------------------------------------------------------
  374.  
  375.  
  376. SOM_Scope void  SOMLINK AppleTest_ClockFulfillPromise(AppleTest_Clock *somSelf, Environment *ev,
  377.         ODStorageUnitView *promiseSUView)
  378. {
  379.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  380.     AppleTest_ClockMethodDebug("Clock","FulfillPromise");
  381.  
  382.     SOM_TRY
  383.  
  384. ODUnused(promiseSUView);
  385.     // Clock Part does not allow embedding of data.
  386.     // This method is not needed.
  387.  
  388.     SOM_CATCH_ALL_ENDTRY
  389. }
  390.  
  391.  
  392. //------------------------------------------------------------------------------
  393. // Clock: DropCompleted
  394. //------------------------------------------------------------------------------
  395.  
  396.  
  397. SOM_Scope void  SOMLINK AppleTest_ClockDropCompleted(AppleTest_Clock *somSelf, Environment *ev,
  398.          ODPart*         destPart, 
  399.                                ODDropResult     dropResult )
  400. {
  401.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  402.     AppleTest_ClockMethodDebug("Clock","DropCompleted");
  403.  
  404.     SOM_TRY
  405.  
  406. ODUnused(destPart);
  407. ODUnused(dropResult);
  408.  
  409.     // Clock Part does not allow embedding of data.
  410.     // This method is not needed.
  411.  
  412.     SOM_CATCH_ALL_ENDTRY
  413. }
  414.  
  415.  
  416. //------------------------------------------------------------------------------
  417. // Clock: DragEnter 
  418. //------------------------------------------------------------------------------
  419.  
  420.  
  421. SOM_Scope ODDragResult  SOMLINK AppleTest_ClockDragEnter(AppleTest_Clock *somSelf, Environment *ev,
  422.          ODDragItemIterator* dragInfo, 
  423.                       ODFacet*            facet, 
  424.                       ODPoint*                where ) 
  425. {
  426.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  427.     AppleTest_ClockMethodDebug("Clock","DragEnter");
  428.  
  429.     SOM_TRY
  430.  
  431. ODUnused(dragInfo);
  432. ODUnused(facet);
  433. ODUnused(where);
  434.  
  435.     // SetCursor(&_fClockPart->fCrossCursor);
  436.     
  437.     return kODFalse;
  438.  
  439.     SOM_CATCH_ALL_ENDTRY
  440.     return kODFalse;
  441. }
  442.  
  443.  
  444. //------------------------------------------------------------------------------
  445. // Clock: DragWithin 
  446. //------------------------------------------------------------------------------
  447.  
  448.  
  449. SOM_Scope ODDragResult  SOMLINK AppleTest_ClockDragWithin(AppleTest_Clock *somSelf, Environment *ev,
  450.          ODDragItemIterator*    dragInfo, 
  451.                        ODFacet*            facet,
  452.                        ODPoint*             where ) 
  453. {
  454.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  455.     AppleTest_ClockMethodDebug("Clock","DragWithin");
  456.  
  457.     SOM_TRY
  458.  
  459. ODUnused(dragInfo);
  460. ODUnused(facet);
  461. ODUnused(where);
  462.  
  463.     // Clock Part does not allow embedding of data.
  464.     // This method is not needed.
  465.  
  466.     return kODFalse;
  467.  
  468.     SOM_CATCH_ALL_ENDTRY
  469.     return kODFalse;
  470. }
  471.  
  472.  
  473. //------------------------------------------------------------------------------
  474. // Clock: DragLeave  
  475. //------------------------------------------------------------------------------
  476.  
  477.  
  478. SOM_Scope void  SOMLINK AppleTest_ClockDragLeave(AppleTest_Clock *somSelf, Environment *ev,
  479.          ODFacet*     facet, 
  480.         ODPoint*        where ) 
  481. {
  482.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  483.     AppleTest_ClockMethodDebug("Clock","DragLeave");
  484.  
  485.     SOM_TRY
  486.  
  487. ODUnused(facet);
  488. ODUnused(where);
  489.  
  490.     // SetCursor(&_fClockPart->fArrowCursor);
  491.  
  492.     SOM_CATCH_ALL_ENDTRY
  493. }
  494.  
  495.  
  496. //------------------------------------------------------------------------------
  497. // Clock: Drop 
  498. //------------------------------------------------------------------------------
  499.  
  500.  
  501.  
  502. SOM_Scope ODDropResult SOMLINK AppleTest_ClockDrop(AppleTest_Clock *somSelf, Environment *ev,
  503.          ODDragItemIterator* dropInfo, 
  504.                  ODFacet*               facet,
  505.                  ODPoint*               where ) 
  506. {
  507.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  508.     AppleTest_ClockMethodDebug("Clock","Drop");
  509.  
  510.     SOM_TRY
  511.  
  512. ODUnused(dropInfo);
  513. ODUnused(facet);
  514. ODUnused(where);
  515.  
  516.     SysBeep(1);
  517.     
  518.     return kODDropFail;
  519.  
  520.     SOM_CATCH_ALL_ENDTRY
  521.     return kODDropFail;
  522. }
  523.  
  524.  
  525. //-------------------------------------------------------------------------
  526. // Implementation for Frame protocol:
  527. //
  528. //        The Frame protocol...
  529. //
  530. //-------------------------------------------------------------------------
  531.  
  532. //------------------------------------------------------------------------------
  533. // Clock: DisplayFrameAdded 
  534. //------------------------------------------------------------------------------
  535.  
  536.  
  537.  
  538. SOM_Scope void  SOMLINK AppleTest_ClockDisplayFrameAdded(AppleTest_Clock *somSelf, Environment *ev,
  539.         ODFrame* frame)
  540. {
  541.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  542.     AppleTest_ClockMethodDebug("Clock","DisplayFrameAdded");
  543.  
  544.     SOM_TRY
  545.  
  546.     _fClockPart->DisplayFrameAdded(ev, frame);
  547.  
  548.     SOM_CATCH_ALL_ENDTRY
  549. }
  550.  
  551.  
  552. //------------------------------------------------------------------------------
  553. // Clock: DisplayFrameRemoved
  554. //------------------------------------------------------------------------------
  555.  
  556.  
  557. SOM_Scope void  SOMLINK AppleTest_ClockDisplayFrameRemoved(AppleTest_Clock *somSelf, Environment *ev,
  558.          ODFrame* oldFrame )
  559. {
  560.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  561.     AppleTest_ClockMethodDebug("Clock","DisplayFrameRemoved");
  562.  
  563.     SOM_TRY
  564.  
  565.     _fClockPart->DisplayFrameRemoved(ev, oldFrame);
  566.  
  567.     SOM_CATCH_ALL_ENDTRY
  568. }
  569.  
  570. //------------------------------------------------------------------------------
  571. // Clock: DisplayFrameConnected
  572. //------------------------------------------------------------------------------
  573.  
  574.  
  575. SOM_Scope void  SOMLINK AppleTest_ClockDisplayFrameConnected(AppleTest_Clock *somSelf, Environment *ev,
  576.         ODFrame* frame)
  577. {
  578.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  579.     AppleTest_ClockMethodDebug("Clock","DisplayFrameConnected");
  580.     
  581.     SOM_TRY
  582.     
  583.     _fClockPart->DisplayFrameConnected(ev, frame);
  584.  
  585.     SOM_CATCH_ALL_ENDTRY
  586. }
  587.  
  588. //------------------------------------------------------------------------------
  589. // Clock: DisplayFrameClosed
  590. //------------------------------------------------------------------------------
  591.  
  592.  
  593. SOM_Scope void  SOMLINK AppleTest_ClockDisplayFrameClosed(AppleTest_Clock *somSelf, Environment *ev,
  594.         ODFrame* frame)
  595. {
  596.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  597.     AppleTest_ClockMethodDebug("Clock","DisplayFrameClosed");
  598.  
  599.     SOM_TRY
  600.  
  601.     _fClockPart->DisplayFrameClosed(ev, frame);
  602.  
  603.     SOM_CATCH_ALL_ENDTRY
  604. }
  605.  
  606. //------------------------------------------------------------------------------
  607. // Clock: FacetAdded 
  608. //------------------------------------------------------------------------------
  609.  
  610.  
  611. SOM_Scope void  SOMLINK AppleTest_ClockFacetAdded(AppleTest_Clock *somSelf, Environment *ev,
  612.         ODFacet* facet)
  613. {
  614.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  615.     AppleTest_ClockMethodDebug("Clock","FacetAdded");
  616.     
  617.     SOM_TRY
  618.  
  619.     ClockFrame* clockFrame = (ClockFrame*) facet->GetFrame(ev)->GetPartInfo(ev);
  620.     if (clockFrame)
  621.         clockFrame->FacetAdded(ev, facet);    
  622.  
  623.     SOM_CATCH_ALL_ENDTRY
  624. }
  625.  
  626. //------------------------------------------------------------------------------
  627. // Clock: FrameShapeChanged 
  628. //------------------------------------------------------------------------------
  629.  
  630.  
  631. SOM_Scope void  SOMLINK AppleTest_ClockFrameShapeChanged(AppleTest_Clock *somSelf, Environment *ev,
  632.         ODFrame* frame)
  633. {
  634.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  635.     AppleTest_ClockMethodDebug("Clock","FrameShapeChanged");
  636.  
  637.     SOM_TRY
  638.  
  639.     ClockFrame* clockFrame = (ClockFrame*) frame->GetPartInfo(ev);
  640.     if (clockFrame)
  641.         clockFrame->FrameShapeChanged(ev);    
  642.  
  643.     SOM_CATCH_ALL_ENDTRY
  644. }
  645.  
  646.  
  647. //------------------------------------------------------------------------------
  648. // Clock: ReadPartInfo
  649. //------------------------------------------------------------------------------
  650.  
  651.  
  652. SOM_Scope ODInfoType  SOMLINK AppleTest_ClockReadPartInfo(AppleTest_Clock *somSelf, Environment *ev,
  653.         ODFrame* frame, ODStorageUnitView*    storageUnitView)
  654. {
  655.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  656.     AppleTest_ClockMethodDebug("Clock","ReadPartInfo");
  657.  
  658.     SOM_TRY
  659.  
  660.     //$$$$$ Shouldn't DisplayFrameConnected get called BEFORE ReadPartInfo?
  661.  
  662.     return _fClockPart->ReadPartInfo(ev, frame, storageUnitView);
  663.  
  664.     SOM_CATCH_ALL_ENDTRY
  665.     return kODNULL;
  666. }
  667.  
  668.  
  669. //------------------------------------------------------------------------------
  670. // Clock: WritePartInfo
  671. //------------------------------------------------------------------------------
  672.  
  673.  
  674. SOM_Scope void  SOMLINK AppleTest_ClockWritePartInfo(AppleTest_Clock *somSelf, Environment *ev,
  675.                     ODInfoType             partInfo, 
  676.                     ODStorageUnitView*    storageUnitView)
  677. {
  678.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  679.     AppleTest_ClockMethodDebug("Clock","WritePartInfo");
  680.  
  681.     SOM_TRY
  682.     
  683. /* We don't need to do this if we don't care about coming up active when embedded
  684.     if (partInfo)
  685.     {
  686.         ODBoolean needsActivating = ((ClockFrame*)partInfo)->fNeedsFoci 
  687.                                      || ((ClockFrame*)partInfo)->fHasFoci;
  688.         StorageUnitSetValue(storageUnitView, ev, sizeof(ODBoolean),
  689.                                     (ODValue)&needsActivating);
  690.     }
  691. */
  692.  
  693.     SOM_CATCH_ALL_ENDTRY
  694. }
  695.  
  696.  
  697. //------------------------------------------------------------------------------
  698. // Clock: ClonePartInfo
  699. //------------------------------------------------------------------------------
  700.  
  701.  
  702. SOM_Scope void  SOMLINK AppleTest_ClockClonePartInfo(AppleTest_Clock *somSelf, Environment *ev,
  703.         ODDraftKey key,
  704.         ODInfoType partInfo,
  705.         ODStorageUnitView* storageUnitView,
  706.         ODFrame* scopeFrame)
  707. {
  708.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  709.     AppleTest_ClockMethodDebug("Clock","ClonePartInfo");
  710.  
  711.     SOM_TRY
  712.     
  713. /* We don't need to do this if we don't care about coming up active when embedded
  714.     if (partInfo)
  715.     {
  716.         ODBoolean needsActivating = ((ClockFrame*)partInfo)->fNeedsFoci 
  717.                                      || ((ClockFrame*)partInfo)->fHasFoci;
  718.         StorageUnitSetValue(storageUnitView, ev, sizeof(ODBoolean),
  719.                                     (ODValue)&needsActivating);
  720.     }
  721. */
  722.  
  723.     SOM_CATCH_ALL_ENDTRY
  724. }
  725.  
  726.  
  727. //------------------------------------------------------------------------------
  728. // Clock: Open
  729. //------------------------------------------------------------------------------
  730.  
  731.     
  732. SOM_Scope ODID  SOMLINK AppleTest_ClockOpen(AppleTest_Clock *somSelf, Environment *ev,
  733.          ODFrame*  frame )
  734. {
  735.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  736.     AppleTest_ClockMethodDebug("Clock","Open");
  737.     
  738.     SOM_TRY
  739.  
  740.     ODID windowID;
  741.     ODWindow* window = kODNULL;
  742.     
  743.     if (frame) // Doing a View As Window or Opening a Root Frame
  744.     {
  745.         if (frame->IsRoot(ev))
  746.         {
  747.             windowID = _fClockPart->OpenRootFrame(ev, frame);
  748.         }
  749.         else
  750.         {
  751.             ClockFrame* clockFrame = (ClockFrame*) frame->GetPartInfo(ev);
  752.             if (clockFrame)
  753.                 windowID = clockFrame->ViewInWindow(ev);
  754.         }
  755.     }
  756.     else
  757.     {
  758.         windowID = _fClockPart->OpenInitialWindow(ev);
  759.     }
  760.     return windowID;
  761.  
  762.     SOM_CATCH_ALL_ENDTRY
  763.     return kODNULLID;
  764. }
  765.  
  766.  
  767.  
  768. //-------------------------------------------------------------------------
  769. // Implementation for Imaging protocol
  770. //-------------------------------------------------------------------------
  771.     
  772. //------------------------------------------------------------------------------
  773. // Clock::Draw
  774. //------------------------------------------------------------------------------
  775.  
  776.     
  777. SOM_Scope void  SOMLINK AppleTest_ClockDraw(AppleTest_Clock *somSelf, 
  778.                                                 Environment *ev,
  779.                                                  ODFacet* facet, 
  780.                                                  ODShape* invalShape)
  781. {
  782.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  783.     AppleTest_ClockMethodDebug("Clock","Draw");
  784.  
  785.     SOM_TRY
  786.  
  787.     ClockFrame* clockFrame = (ClockFrame*) facet->GetFrame(ev)->GetPartInfo(ev);
  788.     if (clockFrame)
  789.     {
  790.         clockFrame->Draw(ev, facet, invalShape);
  791.     }
  792.  
  793.     SOM_CATCH_ALL_ENDTRY
  794. }
  795.  
  796.  
  797. //-------------------------------------------------------------------------
  798. // Implementation for Linking protocol
  799. //-------------------------------------------------------------------------
  800.  
  801. //------------------------------------------------------------------------------
  802. // Clock: CreateLink
  803. //------------------------------------------------------------------------------
  804.  
  805.  
  806.  
  807. SOM_Scope ODLinkSource* SOMLINK AppleTest_ClockCreateLink(AppleTest_Clock *somSelf, Environment *ev,
  808.         ODByteArray* data)
  809. {
  810.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  811.     AppleTest_ClockMethodDebug("Clock","CreateLink");
  812.  
  813.     SOM_TRY
  814.  
  815. ODUnused(data);
  816.  
  817.     return kODNULL;
  818.  
  819.     SOM_CATCH_ALL_ENDTRY
  820.     return kODNULL;
  821. }
  822.  
  823.  
  824. //------------------------------------------------------------------------------
  825. // Clock: LinkUpdated
  826. //------------------------------------------------------------------------------
  827.  
  828.  
  829. SOM_Scope void  SOMLINK AppleTest_ClockLinkUpdated(AppleTest_Clock *somSelf, Environment *ev,
  830.          ODLink*  updatedLink, ODUpdateID change)
  831. {
  832.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  833.     AppleTest_ClockMethodDebug("Clock","LinkUpdated");
  834.  
  835.     SOM_TRY
  836.  
  837. ODUnused(updatedLink);
  838. ODUnused(change);
  839.  
  840.     // does not support linking
  841.  
  842.     SOM_CATCH_ALL_ENDTRY
  843. }
  844.  
  845.  
  846.  
  847. //-------------------------------------------------------------------------
  848. // Implementation for Memory Management protocol
  849. //-------------------------------------------------------------------------
  850.  
  851. SOM_Scope ODSize SOMLINK AppleTest_ClockPurge(AppleTest_Clock *somSelf, Environment *ev,
  852.          ODSize  size )
  853. {
  854.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  855.     AppleTest_ClockMethodDebug("Clock","Purge");
  856.  
  857.     SOM_TRY
  858.  
  859.     ODStorageUnit* su = somSelf->GetStorageUnit(ev);
  860.     return su -> Purge(ev,  size );
  861.  
  862.     SOM_CATCH_ALL_ENDTRY
  863.     return 0;
  864. }
  865.  
  866.  
  867. //-------------------------------------------------------------------------
  868. // Implementation for Storage Management protocol
  869. //-------------------------------------------------------------------------
  870.  
  871. //------------------------------------------------------------------------------
  872. // Clock:  GetOrderedFrameCollection
  873. //------------------------------------------------------------------------------
  874.  
  875.  
  876. extern void GetOrderedFrameCollection(OrderedCollection* aCollection,ODStorageUnit* vfSU);
  877.  
  878. //------------------------------------------------------------------------------
  879. // Clock:  PutOrderedFrameCollection
  880. //------------------------------------------------------------------------------
  881.  
  882.  
  883. extern void PutOrderedFrameCollection(OrderedCollection* aCollection,ODStorageUnit* vfSU);
  884.  
  885. //------------------------------------------------------------------------------
  886. // Clock:  Externalize
  887. //------------------------------------------------------------------------------
  888.  
  889. SOM_Scope void  SOMLINK AppleTest_ClockExternalize(AppleTest_Clock *somSelf, Environment *ev)
  890. {
  891.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  892.     AppleTest_ClockMethodDebug("Clock","Externalize");
  893.  
  894.     SOM_TRY
  895.  
  896.     // Give a chance for the parent to Externalize
  897.     parent_Externalize(somSelf, ev);
  898.  
  899.     // Externalize itself
  900.     _fClockPart->Externalize(ev);
  901.  
  902.     SOM_CATCH_ALL_ENDTRY
  903. }
  904.  
  905.  
  906.  
  907. //-------------------------------------------------------------------------
  908. // Implementation for Part Activation protocol
  909. //-------------------------------------------------------------------------
  910.     
  911. //------------------------------------------------------------------------------
  912. // Clock: BeginRelinquishFocus
  913. //------------------------------------------------------------------------------
  914.  
  915.  
  916. SOM_Scope ODBoolean  SOMLINK AppleTest_ClockBeginRelinquishFocus(AppleTest_Clock *somSelf, Environment *ev,
  917.          ODTypeToken     focus,
  918.                                      ODFrame*         currentFrame,
  919.                                      ODFrame*         proposedFrame )
  920. {
  921.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  922.     AppleTest_ClockMethodDebug("Clock","BeginRelinquishFocus");
  923.  
  924.     SOM_TRY
  925.  
  926.     ClockFrame* clockFrame = (ClockFrame*) currentFrame->GetPartInfo(ev);
  927.     
  928.     if (clockFrame)
  929.         return clockFrame->BeginRelinquishFocus(ev, focus, proposedFrame); 
  930.     else 
  931.         return kODTrue;
  932.  
  933.  
  934.     SOM_CATCH_ALL_ENDTRY
  935.     return kODFalse;
  936. }
  937.     
  938.     
  939. //------------------------------------------------------------------------------
  940. // Clock: CommitRelinquishFocus
  941. //------------------------------------------------------------------------------
  942.  
  943.  
  944. SOM_Scope void  SOMLINK AppleTest_ClockCommitRelinquishFocus(AppleTest_Clock *somSelf, Environment *ev,
  945.          ODTypeToken     focus,
  946.                             ODFrame*         currentFrame,
  947.                             ODFrame*        proposedFrame )
  948. {
  949.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  950.     AppleTest_ClockMethodDebug("Clock","CommitRelinquishFocus");
  951.  
  952.     SOM_TRY
  953.  
  954.     ClockFrame* clockFrame = (ClockFrame*) currentFrame->GetPartInfo(ev);
  955.     
  956.     if (clockFrame)
  957.         clockFrame->CommitRelinquishFocus(ev, focus, proposedFrame); 
  958.  
  959.     SOM_CATCH_ALL_ENDTRY
  960. }
  961.     
  962.                             
  963. //------------------------------------------------------------------------------
  964. // Clock: AbortRelinquishFocus
  965. //------------------------------------------------------------------------------
  966.  
  967.  
  968. SOM_Scope void  SOMLINK AppleTest_ClockAbortRelinquishFocus(AppleTest_Clock *somSelf, Environment *ev,
  969.          ODTypeToken    focus,
  970.                                   ODFrame*        currentFrame,
  971.                                   ODFrame*        proposedFrame )
  972. {
  973.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  974.     AppleTest_ClockMethodDebug("Clock","AbortRelinquishFocus");
  975.  
  976.     SOM_TRY
  977.  
  978.     ClockFrame* clockFrame = (ClockFrame*) currentFrame->GetPartInfo(ev);
  979.     
  980.     if (clockFrame)
  981.         clockFrame->AbortRelinquishFocus(ev, focus, proposedFrame); 
  982.  
  983.     SOM_CATCH_ALL_ENDTRY
  984. }
  985.             
  986.                               
  987. //------------------------------------------------------------------------------
  988. // Clock: FocusAcquired
  989. //------------------------------------------------------------------------------
  990.  
  991.  
  992. SOM_Scope void  SOMLINK AppleTest_ClockFocusAcquired(AppleTest_Clock *somSelf, Environment *ev,
  993.          ODTypeToken    focus, 
  994.                           ODFrame*        newOwner )
  995. {
  996.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  997.     AppleTest_ClockMethodDebug("Clock","FocusAcquired");
  998.  
  999.     SOM_TRY
  1000.  
  1001.     ClockFrame* clockFrame = (ClockFrame*) newOwner->GetPartInfo(ev);
  1002.     
  1003.     if (clockFrame)
  1004.         clockFrame->FocusAcquired(ev, focus); 
  1005.  
  1006.     SOM_CATCH_ALL_ENDTRY
  1007. }    
  1008.  
  1009.  
  1010. //------------------------------------------------------------------------------
  1011. // Clock: FocusLost
  1012. //------------------------------------------------------------------------------
  1013.  
  1014.  
  1015. SOM_Scope void  SOMLINK AppleTest_ClockFocusLost(AppleTest_Clock *somSelf, Environment *ev,
  1016.          ODTypeToken    focus, 
  1017.                       ODFrame*     oldOwner )
  1018. {
  1019.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1020.     AppleTest_ClockMethodDebug("Clock","FocusLost");
  1021.  
  1022.     SOM_TRY
  1023.  
  1024.     ClockFrame* clockFrame = (ClockFrame*) oldOwner->GetPartInfo(ev);
  1025.     
  1026.     if (clockFrame)
  1027.         clockFrame->FocusLost(ev, focus, kODNULL); 
  1028.  
  1029.     SOM_CATCH_ALL_ENDTRY
  1030. }    
  1031.  
  1032.  
  1033. //-------------------------------------------------------------------------
  1034. // Implementation for UI Events protocol
  1035. //-------------------------------------------------------------------------
  1036.     
  1037. //------------------------------------------------------------------------------
  1038. // Clock: HandleEvent
  1039. //------------------------------------------------------------------------------
  1040.  
  1041.  
  1042. SOM_Scope ODBoolean  SOMLINK AppleTest_ClockHandleEvent(AppleTest_Clock *somSelf, Environment *ev,
  1043.                          ODEventData* event,
  1044.                         ODFrame* frame,
  1045.                         ODFacet* facet,
  1046.                         ODEventInfo* eventInfo )
  1047. {
  1048.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1049.     AppleTest_ClockMethodDebug("Clock","HandleEvent");
  1050.  
  1051.     SOM_TRY
  1052.  
  1053.     ODBoolean    wasHandled = kODFalse;
  1054.     ClockFrame* clockFrame = (ClockFrame*) frame->GetPartInfo(ev);
  1055.     
  1056.     switch ( event -> what ) {
  1057.         case kODEvtNull:
  1058.             {
  1059.                 if (clockFrame)
  1060.                     clockFrame->Idle(ev, event);
  1061.                 else
  1062.                     _fClockPart->Idle(ev, event);
  1063.                 wasHandled = kODTrue;
  1064.                 break;
  1065.             }
  1066.             
  1067.         case kODEvtMouseDown:
  1068.             if (facet == kODNULL)
  1069.             {
  1070.                 wasHandled = kODTrue;
  1071.             }
  1072.             else
  1073.             {
  1074.                 wasHandled = clockFrame->HandleMouseDown(ev, facet, event);
  1075.             }
  1076.             break;
  1077.                         
  1078.         case kODEvtMouseUp:
  1079.             if (facet == kODNULL)
  1080.             {
  1081.                 wasHandled = kODTrue;
  1082.             }
  1083.             else
  1084.             {
  1085.                 wasHandled = clockFrame->HandleMouseUp(ev, facet, event);
  1086.             }
  1087.             break;
  1088.         
  1089.         case kODEvtMouseDownEmbedded:
  1090.             break;
  1091.             
  1092.         case kODEvtKeyDown:
  1093.         case kODEvtAutoKey:
  1094.         case kODEvtKeyUp:
  1095.             wasHandled = kODFalse;
  1096.             break;
  1097.             
  1098.         case kODEvtActivate:
  1099.             wasHandled = true; // actually ignored by dispatcher
  1100.             if ((event->modifiers & activeFlag ) != 0)
  1101.                 clockFrame->ActivatingWindow(ev, facet, event);
  1102.             else
  1103.                 clockFrame->DeactivatingWindow(ev, facet, event);
  1104.             break;
  1105.         case kODEvtOS:
  1106.             _fClockPart->HandleOSEvent(ev, event, frame, facet);
  1107.             wasHandled = kODTrue;
  1108.             break;
  1109.         case kHighLevelEvent:
  1110.             break;
  1111.         case kODEvtMenu:
  1112.             {
  1113.                 wasHandled = clockFrame->HandleMenuEvent(ev, event);
  1114.                 break;
  1115.             }
  1116.         case kODEvtWindow: 
  1117.             {
  1118.                 switch (event->message)
  1119.                 {
  1120.                     case inGoAway:
  1121.                         wasHandled = _fClockPart->CloseWindow(ev, frame);
  1122.                         break;
  1123.                     case inZoomIn:
  1124.                     case inZoomOut:
  1125.                         SysBeep(2); 
  1126.                         wasHandled = kODTrue;
  1127.                         break;
  1128.                     default:
  1129.                         break;
  1130.                 }
  1131.             }
  1132.             break;
  1133.         case kODEvtMouseEnter:
  1134.             clockFrame->MouseEnter(ev, facet, &(eventInfo->where));
  1135.             wasHandled = kODTrue;
  1136.             break;
  1137.         case kODEvtMouseWithin:
  1138.             clockFrame->MouseWithin(ev, facet, &(eventInfo->where));
  1139.             wasHandled = kODTrue;
  1140.             break;
  1141.         case kODEvtMouseLeave:
  1142.             clockFrame->MouseLeave(ev, facet);
  1143.             wasHandled = kODTrue;
  1144.             break;
  1145.         default:
  1146.             break;
  1147.     }
  1148.     
  1149.     return wasHandled;
  1150.  
  1151.     SOM_CATCH_ALL_ENDTRY
  1152.     return kODFalse;
  1153. }
  1154.  
  1155. //------------------------------------------------------------------------------
  1156. // Clock: AdjustMenus
  1157. //------------------------------------------------------------------------------
  1158.  
  1159. SOM_Scope void  SOMLINK AppleTest_ClockAdjustMenus(AppleTest_Clock *somSelf, Environment *ev,
  1160.          ODFrame* frame)
  1161. {
  1162.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1163.     AppleTest_ClockMethodDebug("Clock","AdjustMenus");
  1164.  
  1165.     SOM_TRY
  1166.  
  1167.      ClockFrame* clockFrame = (ClockFrame*) frame->GetPartInfo(ev);
  1168.    
  1169.     clockFrame->AdjustMenus(ev);
  1170.  
  1171.     SOM_CATCH_ALL_ENDTRY
  1172. }
  1173.  
  1174.  
  1175.  
  1176.  
  1177. //-------------------------------------------------------------------------
  1178. // SemanticInterface
  1179. //-------------------------------------------------------------------------
  1180.  
  1181.  
  1182. SOM_Scope ODExtension* SOMLINK AppleTest_ClockAcquireExtension(AppleTest_Clock *somSelf, Environment *ev,
  1183.         ODType extensionName)
  1184. {
  1185.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1186.     AppleTest_ClockMethodDebug("Clock","AcquireExtension");
  1187.  
  1188.     SOM_TRY
  1189.  
  1190.     if (!ODISOStrCompare( (ODISOStr)extensionName, kODExtSemanticInterface ))
  1191.         return ( (ODExtension*)_fClockPart->AquireSI(ev) );
  1192.     else
  1193.         return kODNULL;
  1194.  
  1195.     SOM_CATCH_ALL_ENDTRY
  1196.     return kODNULL;
  1197. }
  1198.  
  1199.  
  1200. SOM_Scope ODBoolean  SOMLINK AppleTest_ClockHasExtension(AppleTest_Clock *somSelf, Environment *ev,
  1201.         ODType extensionName)
  1202. {
  1203.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1204.     AppleTest_ClockMethodDebug("Clock","HasExtension");
  1205.  
  1206.     SOM_TRY
  1207.     
  1208.     if (!ODISOStrCompare( (ODISOStr)extensionName, kODExtSemanticInterface ))
  1209.         return kODTrue;
  1210.     else
  1211.         return kODFalse;
  1212.  
  1213.     SOM_CATCH_ALL_ENDTRY
  1214.     return kODFalse;
  1215. }
  1216.  
  1217. SOM_Scope void  SOMLINK AppleTest_ClockReleaseExtension(AppleTest_Clock *somSelf, Environment *ev,
  1218.         ODExtension* extension)
  1219. {
  1220.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1221.     AppleTest_ClockMethodDebug("Clock","ReleaseExtension");
  1222.  
  1223.     SOM_TRY
  1224.     
  1225.     // the ClockSI extension is destroyed when the ClockPart is destroyed
  1226.  
  1227.     SOM_CATCH_ALL_ENDTRY
  1228. }
  1229.  
  1230. //------------------------------------------------------------------------------
  1231. // Clock: Stubs for unimplemented methods
  1232. //------------------------------------------------------------------------------
  1233.  
  1234.  
  1235. SOM_Scope void  SOMLINK AppleTest_ClockUndoAction(AppleTest_Clock *somSelf, Environment *ev,
  1236.         ODActionData* actionState)
  1237. {
  1238.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1239.     AppleTest_ClockMethodDebug("AppleTest_Clock","AppleTest_ClockUndoAction");
  1240.  
  1241.     SOM_TRY
  1242.     
  1243.  
  1244.     SOM_CATCH_ALL_ENDTRY
  1245. }
  1246.  
  1247. SOM_Scope void  SOMLINK AppleTest_ClockRedoAction(AppleTest_Clock *somSelf, Environment *ev,
  1248.         ODActionData* actionState)
  1249. {
  1250.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1251.     AppleTest_ClockMethodDebug("AppleTest_Clock","AppleTest_ClockRedoAction");
  1252.  
  1253.     SOM_TRY
  1254.     
  1255.  
  1256.     SOM_CATCH_ALL_ENDTRY
  1257. }
  1258.  
  1259. SOM_Scope void  SOMLINK AppleTest_ClockDisposeActionState(AppleTest_Clock *somSelf, Environment *ev,
  1260.         ODActionData* actionState,
  1261.         ODDoneState doneState)
  1262. {
  1263.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1264.     AppleTest_ClockMethodDebug("AppleTest_Clock","AppleTest_ClockDisposeActionState");
  1265.  
  1266.     SOM_TRY
  1267.     
  1268.  
  1269.     SOM_CATCH_ALL_ENDTRY
  1270. }
  1271.  
  1272. SOM_Scope void  SOMLINK AppleTest_ClockWriteActionState(AppleTest_Clock *somSelf, Environment *ev,
  1273.         ODActionData* actionState,
  1274.         ODStorageUnitView* storageUnitView)
  1275. {
  1276.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1277.     AppleTest_ClockMethodDebug("AppleTest_Clock","AppleTest_ClockWriteActionState");
  1278.         
  1279.     SOM_TRY
  1280.     
  1281.  
  1282.     SOM_CATCH_ALL_ENDTRY
  1283. }
  1284.  
  1285. SOM_Scope ODActionData  SOMLINK AppleTest_ClockReadActionState(AppleTest_Clock *somSelf, Environment *ev,
  1286.         ODStorageUnitView* storageUnitView)
  1287. {
  1288.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1289.     AppleTest_ClockMethodDebug("AppleTest_Clock","AppleTest_ClockReadActionState");
  1290.         
  1291.     ODActionData data;
  1292.  
  1293.     data._maximum = 0;
  1294.     data._length = 0;
  1295.     data._buffer = kODNULL;
  1296.     return data;
  1297. }
  1298.  
  1299. SOM_Scope void  SOMLINK AppleTest_ClockCloneInto(AppleTest_Clock *somSelf, Environment *ev,
  1300.         ODDraftKey key,
  1301.         ODStorageUnit* storageUnit,
  1302.         ODFrame* scopeFrame)
  1303. {
  1304.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1305.     AppleTest_ClockMethodDebug("AppleTest_Clock","AppleTest_ClockCloneInto");
  1306.  
  1307.     SOM_TRY
  1308.     
  1309.     parent_CloneInto(somSelf,ev,key,storageUnit,scopeFrame);
  1310.  
  1311.     // If one of our properties already exists, this object has been cloned already
  1312.  
  1313.     if ( storageUnit->Exists(ev, kODPropContents, kODNULL, 0) )
  1314.         return;
  1315.  
  1316.     _fClockPart->CloneInto(ev, key, storageUnit, scopeFrame);
  1317.  
  1318.  
  1319.     SOM_CATCH_ALL_ENDTRY
  1320. }
  1321.  
  1322. SOM_Scope void  SOMLINK AppleTest_ClockExternalizeKinds(AppleTest_Clock *somSelf, Environment *ev,
  1323.         ODTypeList* kindset)
  1324. {
  1325.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1326.     AppleTest_ClockMethodDebug("AppleTest_Clock","AppleTest_ClockExternalizeKinds");
  1327.  
  1328.     SOM_TRY
  1329.     
  1330.  
  1331.     SOM_CATCH_ALL_ENDTRY
  1332. }
  1333.  
  1334. SOM_Scope void  SOMLINK AppleTest_ClockChangeKind(AppleTest_Clock *somSelf, Environment *ev,
  1335.         ODType kind)
  1336. {
  1337.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1338.     AppleTest_ClockMethodDebug("AppleTest_Clock","AppleTest_ClockChangeKind");
  1339.  
  1340.     SOM_TRY
  1341.     
  1342.  
  1343.     SOM_CATCH_ALL_ENDTRY
  1344. }
  1345.  
  1346.  
  1347. SOM_Scope void  SOMLINK AppleTest_ClockCanvasUpdated(AppleTest_Clock *somSelf, Environment *ev,
  1348.         ODCanvas* canvas)
  1349. {
  1350.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1351.     AppleTest_ClockMethodDebug("AppleTest_Clock","AppleTest_ClockCanvasUpdated");
  1352.  
  1353.     SOM_TRY
  1354.     
  1355.  
  1356.     SOM_CATCH_ALL_ENDTRY
  1357. }
  1358.  
  1359. SOM_Scope void  SOMLINK AppleTest_ClockHighlightChanged(AppleTest_Clock *somSelf, Environment *ev,
  1360.         ODFacet* facet)
  1361. {
  1362.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1363.     AppleTest_ClockMethodDebug("AppleTest_Clock","AppleTest_ClockHighlightChanged");
  1364.  
  1365.     SOM_TRY
  1366.     
  1367.  
  1368.     SOM_CATCH_ALL_ENDTRY
  1369. }
  1370.  
  1371. SOM_Scope ODULong  SOMLINK AppleTest_ClockGetPrintResolution(AppleTest_Clock *somSelf, Environment *ev,
  1372.         ODFrame* frame)
  1373. {
  1374.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1375.     AppleTest_ClockMethodDebug("AppleTest_Clock","AppleTest_ClockGetPrintResolution");
  1376.  
  1377.     SOM_TRY
  1378.     
  1379.     return 0;
  1380.  
  1381.     SOM_CATCH_ALL_ENDTRY
  1382.     return 0;
  1383. }
  1384.  
  1385. SOM_Scope void  SOMLINK AppleTest_ClockRevealLink(AppleTest_Clock *somSelf, Environment *ev,
  1386.         ODLinkSource* linkSource)
  1387. {
  1388.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1389.     AppleTest_ClockMethodDebug("AppleTest_Clock","AppleTest_ClockRevealLink");
  1390.         
  1391.     SOM_TRY
  1392.     
  1393.  
  1394.     SOM_CATCH_ALL_ENDTRY
  1395. }
  1396.  
  1397. SOM_Scope void  SOMLINK AppleTest_ClockEmbeddedFrameUpdated(AppleTest_Clock *somSelf, Environment *ev,
  1398.         ODFrame* frame,
  1399.         ODUpdateID change)
  1400. {
  1401.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1402.     AppleTest_ClockMethodDebug("AppleTest_Clock","AppleTest_ClockEmbeddedFrameUpdated");
  1403.         
  1404.     SOM_TRY
  1405.     
  1406.  
  1407.     SOM_CATCH_ALL_ENDTRY
  1408. }
  1409.  
  1410. SOM_Scope void  SOMLINK AppleTest_ClockLinkStatusChanged(AppleTest_Clock *somSelf, Environment *ev,
  1411.         ODFrame* frame)
  1412. {
  1413.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1414.     AppleTest_ClockMethodDebug("AppleTest_Clock","AppleTest_ClockLinkStatusChanged");
  1415.         
  1416.     SOM_TRY
  1417.     
  1418.  
  1419.     SOM_CATCH_ALL_ENDTRY
  1420. }
  1421.  
  1422.  
  1423. SOM_Scope void  SOMLINK AppleTest_ClockFacetRemoved(AppleTest_Clock *somSelf, Environment *ev,
  1424.         ODFacet* facet)
  1425. {
  1426.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1427.     AppleTest_ClockMethodDebug("AppleTest_Clock","AppleTest_ClockFacetRemoved");
  1428.         
  1429.     SOM_TRY
  1430.     
  1431.  
  1432.     SOM_CATCH_ALL_ENDTRY
  1433. }
  1434.  
  1435. SOM_Scope void  SOMLINK AppleTest_ClockCanvasChanged(AppleTest_Clock *somSelf, Environment *ev,
  1436.         ODFacet* facet)
  1437. {
  1438.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1439.     AppleTest_ClockMethodDebug("AppleTest_Clock","AppleTest_ClockCanvasChanged");
  1440.         
  1441.     SOM_TRY
  1442.     
  1443.  
  1444.     SOM_CATCH_ALL_ENDTRY
  1445. }
  1446.  
  1447. SOM_Scope ODFrame*  SOMLINK AppleTest_ClockRequestEmbeddedFrame(AppleTest_Clock *somSelf, Environment *ev,
  1448.         ODFrame* containingFrame,
  1449.         ODFrame* baseFrame,
  1450.         ODShape* frameShape,
  1451.         ODPart* embedPart,
  1452.         ODTypeToken viewType,
  1453.         ODTypeToken presentation,
  1454.         ODBoolean isOverlaid)
  1455. {
  1456.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1457.     AppleTest_ClockMethodDebug("AppleTest_Clock","AppleTest_ClockRequestEmbeddedFrame");
  1458.  
  1459.     SOM_TRY
  1460.     
  1461.     ODSetSOMException(ev, kODErrCannotEmbed);
  1462.  
  1463.     return kODNULL;
  1464.  
  1465.     SOM_CATCH_ALL_ENDTRY
  1466.     return kODNULL;
  1467. }
  1468.  
  1469. SOM_Scope void  SOMLINK AppleTest_ClockRemoveEmbeddedFrame(AppleTest_Clock *somSelf, Environment *ev,
  1470.         ODFrame* embeddedFrame)
  1471. {
  1472.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1473.     AppleTest_ClockMethodDebug("AppleTest_Clock","AppleTest_ClockRemoveEmbeddedFrame");
  1474.         
  1475.     SOM_TRY
  1476.     
  1477.  
  1478.     SOM_CATCH_ALL_ENDTRY
  1479. }
  1480.  
  1481. SOM_Scope ODShape*  SOMLINK AppleTest_ClockRequestFrameShape(AppleTest_Clock *somSelf, Environment *ev,
  1482.         ODFrame* embeddedFrame,
  1483.         ODShape* frameShape)
  1484. {
  1485.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1486.     AppleTest_ClockMethodDebug("AppleTest_Clock","AppleTest_ClockRequestFrameShape");
  1487.  
  1488.     SOM_TRY
  1489.     
  1490.     return (frameShape);
  1491.  
  1492.     SOM_CATCH_ALL_ENDTRY
  1493.     return frameShape;
  1494. }
  1495.  
  1496. SOM_Scope void  SOMLINK AppleTest_ClockUsedShapeChanged(AppleTest_Clock *somSelf, Environment *ev,
  1497.         ODFrame* embeddedFrame)
  1498. {
  1499.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1500.     AppleTest_ClockMethodDebug("AppleTest_Clock","AppleTest_ClockUsedShapeChanged");
  1501.         
  1502.     SOM_TRY
  1503.     
  1504.  
  1505.     SOM_CATCH_ALL_ENDTRY
  1506. }
  1507.  
  1508. SOM_Scope ODShape*  SOMLINK AppleTest_ClockAdjustBorderShape(AppleTest_Clock *somSelf, Environment *ev,
  1509.         ODFacet* embeddedFacet,
  1510.         ODShape* shape)
  1511. {
  1512.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1513.     AppleTest_ClockMethodDebug("AppleTest_Clock","AppleTest_ClockAdjustBorderShape");
  1514.  
  1515.     SOM_TRY
  1516.     
  1517.     ODAcquireObject(ev, shape);
  1518.     return shape;
  1519.  
  1520.     SOM_CATCH_ALL_ENDTRY
  1521.     return kODNULL;
  1522. }
  1523.  
  1524.  
  1525. SOM_Scope void  SOMLINK AppleTest_ClockViewTypeChanged(AppleTest_Clock *somSelf, Environment *ev,
  1526.         ODFrame* frame)
  1527. {
  1528.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1529.     AppleTest_ClockMethodDebug("AppleTest_Clock","AppleTest_ClockViewTypeChanged");
  1530.  
  1531.     SOM_TRY
  1532.     
  1533.     //$$$$$ Delegate to frame method. Clock doesn't yet support other view types 
  1534.  
  1535.     SOM_CATCH_ALL_ENDTRY
  1536. }
  1537.  
  1538. SOM_Scope void  SOMLINK AppleTest_ClockPresentationChanged(AppleTest_Clock *somSelf, Environment *ev,
  1539.         ODFrame* frame)
  1540. {
  1541.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1542.     AppleTest_ClockMethodDebug("AppleTest_Clock","AppleTest_ClockPresentationChanged");
  1543.         
  1544.     SOM_TRY
  1545.         
  1546.     //$$$$$ Delegate to frame method. 
  1547.  
  1548.     SOM_CATCH_ALL_ENDTRY
  1549. }
  1550.  
  1551. SOM_Scope void  SOMLINK AppleTest_ClockSequenceChanged(AppleTest_Clock *somSelf, Environment *ev,
  1552.         ODFrame* frame)
  1553. {
  1554.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1555.     AppleTest_ClockMethodDebug("AppleTest_Clock","AppleTest_ClockSequenceChanged");
  1556.         
  1557.     SOM_TRY
  1558.     
  1559.  
  1560.     SOM_CATCH_ALL_ENDTRY
  1561. }
  1562.  
  1563.  
  1564. SOM_Scope void  SOMLINK AppleTest_ClockGeometryChanged(AppleTest_Clock *somSelf, Environment *ev,
  1565.         ODFacet* facet, ODBoolean clipShapeChanged, ODBoolean externalTransformChanged)
  1566. {
  1567.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1568.     AppleTest_ClockMethodDebug("AppleTest_Clock","AppleTest_ClockGeometryChanged");
  1569.         
  1570.     SOM_TRY
  1571.     
  1572.     facet->Invalidate(ev, kODNULL, kODNULL); // Would be better to invalidate difference
  1573.     //$$$$$ Delegate to frame method
  1574.  
  1575.     SOM_CATCH_ALL_ENDTRY
  1576. }
  1577.  
  1578.  
  1579. SOM_Scope void  SOMLINK AppleTest_ClockAttachSourceFrame(AppleTest_Clock *somSelf, Environment *ev,
  1580.         ODFrame* frame,
  1581.         ODFrame* sourceFrame)
  1582. {
  1583.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1584.     AppleTest_ClockMethodDebug("AppleTest_Clock","AppleTest_ClockAttachSourceFrame");
  1585.         
  1586.     SOM_TRY
  1587.     
  1588.  
  1589.     SOM_CATCH_ALL_ENDTRY
  1590. }
  1591.  
  1592.  
  1593. SOM_Scope void  SOMLINK AppleTest_ClockRelease(AppleTest_Clock *somSelf, Environment *ev)
  1594. {
  1595.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1596.     AppleTest_ClockMethodDebug("AppleTest_Clock","AppleTest_ClockRelease");
  1597.         
  1598.     SOM_TRY
  1599.     
  1600.     parent_Release(somSelf, ev);
  1601.     
  1602.     if( _fClockPart )
  1603.         _fClockPart->Release(ev);
  1604.  
  1605.     SOM_CATCH_ALL_ENDTRY
  1606. }
  1607.  
  1608. SOM_Scope void  SOMLINK AppleTest_ClockReleaseAll(AppleTest_Clock *somSelf, Environment *ev)
  1609. {
  1610.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1611.     AppleTest_ClockMethodDebug("AppleTest_Clock","AppleTest_ClockReleaseAll");
  1612.  
  1613.     SOM_TRY
  1614.     
  1615. //    PRINT("Clock Release All\n");
  1616.  
  1617.     if( _fClockPart )
  1618.         _fClockPart->ReleaseAll(ev);
  1619.  
  1620.     SOM_CATCH_ALL_ENDTRY
  1621. }
  1622.  
  1623. SOM_Scope void  SOMLINK AppleTest_ClockContainingPartPropertiesUpdated(AppleTest_Clock *somSelf, Environment *ev,
  1624.         ODFrame* frame,
  1625.         ODStorageUnit* propertyUnit)
  1626. {
  1627.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1628.     AppleTest_ClockMethodDebug("AppleTest_Clock","AppleTest_ClockContainingPartPropertiesUpdated");
  1629.         
  1630.     SOM_TRY
  1631.     
  1632.     AppleTest_Clock_parent_ODPart_ContainingPartPropertiesUpdated(somSelf,ev,frame,propertyUnit);
  1633.  
  1634.     SOM_CATCH_ALL_ENDTRY
  1635. }
  1636.  
  1637. SOM_Scope ODStorageUnit*  SOMLINK AppleTest_ClockAcquireContainingPartProperties(AppleTest_Clock *somSelf, Environment *ev,
  1638.         ODFrame* frame)
  1639. {
  1640.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1641.     AppleTest_ClockMethodDebug("AppleTest_Clock","AppleTest_ClockAcquireContainingPartProperties");
  1642.         
  1643.     SOM_TRY
  1644.     
  1645.     ODSetSOMException(ev, kODErrCannotEmbed);
  1646.  
  1647.     return kODNULL;
  1648.  
  1649.     SOM_CATCH_ALL_ENDTRY
  1650.     return kODNULL;
  1651. }
  1652.  
  1653. SOM_Scope ODBoolean  SOMLINK AppleTest_ClockRevealFrame(AppleTest_Clock *somSelf, Environment *ev,
  1654.         ODFrame* embeddedFrame,
  1655.         ODShape* revealShape)
  1656. {
  1657.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1658.     AppleTest_ClockMethodDebug("AppleTest_Clock","AppleTest_ClockRevealFrame");
  1659.     
  1660.     SOM_TRY
  1661.     
  1662.     ODSetSOMException(ev, kODErrInvalidFrame);
  1663.     return kODFalse;
  1664.  
  1665.     SOM_CATCH_ALL_ENDTRY
  1666.     return kODFalse;
  1667. }
  1668.  
  1669. SOM_Scope void  SOMLINK AppleTest_ClockEmbeddedFrameSpec(AppleTest_Clock *somSelf, Environment *ev,
  1670.         ODFrame* embeddedFrame,
  1671.         ODObjectSpec* spec)
  1672. {
  1673.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1674.     AppleTest_ClockMethodDebug("AppleTest_Clock","AppleTest_ClockEmbeddedFrameSpec");
  1675.         
  1676.     SOM_TRY
  1677.     
  1678.     ODSetSOMException(ev, kODErrInvalidFrame);
  1679.  
  1680.     SOM_CATCH_ALL_ENDTRY
  1681. }
  1682.  
  1683. SOM_Scope ODEmbeddedFramesIterator*  SOMLINK AppleTest_ClockCreateEmbeddedFramesIterator(AppleTest_Clock *somSelf, Environment *ev,
  1684.         ODFrame* frame)
  1685. {
  1686.     AppleTest_ClockData *somThis = AppleTest_ClockGetData(somSelf);
  1687.     AppleTest_ClockMethodDebug("AppleTest_Clock","AppleTest_ClockCreateEmbeddedFramesIterator");
  1688.         
  1689.     SOM_TRY
  1690.     
  1691.     ODSetSOMException(ev, kODErrCannotEmbed);
  1692.  
  1693.     return kODNULL;
  1694.  
  1695.     SOM_CATCH_ALL_ENDTRY
  1696.     return kODNULL;
  1697. }
  1698.  
  1699.